package galaxy.generator;

public class Rule {
	private String input;
	private String output;
	
	public Rule(String input, String output)
	{
		this.input = input;
		this.output = output;
	}
	
	public Rule(String input)
	{
		this.input = input;
	}
	
	public Rule setOutput(String output)
	{
		this.output = output;
		return this;
	}
	
	public boolean accept(Node s)
	{
		return input.equals(s.getValue());
	}
	
	public Node apply(Node s)
	{
		return s.addChildren(Node.createList(output));
	}
}
